package com.eoekun.dashboard.model;


import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import com.alibaba.fastjson.JSON;

/**
 * 分页返回对象
 * 
 * @author chenkun
 * @createTime 2019年3月7日 下午2:30:57
 * @param <T>
 */
public class PageVO<T extends Serializable> implements Serializable {

    private static final long serialVersionUID = 1L;
    /** 当前页码数据对象 */
    private List<T> data = Collections.emptyList();
    /** 总记录数 */
    private Long total = 0L;

    public PageVO() {

    }

    public PageVO(List<T> data, Long total) {
        super();
        this.data = data;
        this.total = total;
    }

    public static <T extends Serializable> PageVO<T> ofEmpty() {
        return new PageVO<>();
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}
